package com.xinshujia.task;

/**
 * **********************************
 * *   @author: 野狼上校               **
 * *   @since: 2024-07-04 09:43      **
 * *   @version: 1.0                 **
 *************************************/

import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.scheduling.quartz.QuartzJobBean;

/**
 * 定时任务
 */
public class DeviceQuartzTask extends QuartzJobBean {
//   /* private final QuartzHandler quartzHandler;
//
//    public DeviceQuartzTask(QuartzHandler quartzHandler) {
//        this.quartzHandler = quartzHandler;
//    }*/

    /**
     * 定时任务的核心方法
     */
    @Override
    protected void executeInternal(JobExecutionContext context) throws JobExecutionException {
        // 在创建定时任务的时候把设备的deviceGuid作为定时任务的名称
        String key = context.getJobDetail().getKey().toString();
        String deviceGuid = key.substring(key.lastIndexOf(".") + 1);
        // 执行任务的逻辑（实时阈值设置）
        System.out.println(deviceGuid + ": run.......");
//        quartzHandler.handle(deviceGuid);
    }
}
